home *** CD-ROM | disk | FTP | other *** search
/ Acorn User: China / Acorn User China CD-ROM (UK) (Disc B) / Acorn User China CD-ROM (UK) (Disc B).bin / BARNET / ARMLINUX / MAIL / 9701 / text0010.txt < prev    next >
Encoding:
Internet Message Format  |  1998-01-25  |  2.4 KB

  1. Date:     Mon, 20 Jan 1997 12:25:15 +0000 (GMT)
  2. From: Philip Blundell <pjb27@cam.ac.uk>
  3. X-Sender: pjb27@hammer.thor.cam.ac.uk
  4. To: Joseph Heenan <esuvf@csv.warwick.ac.uk>
  5. Cc: linux-arm@vger.rutgers.edu
  6. Subject: Re: Arm Linux
  7. In-Reply-To: <28500.199701201213@lupin.csv.warwick.ac.uk>
  8. Message-Id: <Pine.SOL.3.95.970120121454.7874E-100000@hammer.thor.cam.ac.uk>
  9. Mime-Version: 1.0
  10. Content-Type: TEXT/PLAIN; charset=US-ASCII
  11. Sender: owner-linux-arm@vger.rutgers.edu
  12. Precedence: bulk
  13.  
  14. On Mon, 20 Jan 1997, Joseph Heenan wrote:
  15.  
  16. > Perhaps I've got the wrong end of the stick here - I'd assumed
  17. > debian would be a lot of C sources that just need perhaps the odd
  18. > bit of inline assembler rewriting. Surely the C compiler should handle
  19. > all the platform specific things, apart from inline assembler?
  20.  
  21. No.  To take a contrived example, imagine you have this:
  22.  
  23. unsigned char foo[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9 };
  24. unsigned int *bar;
  25.  
  26. bar = (unsigned int *)(foo+1);
  27. printf("bar = %08x\n", *bar);
  28.  
  29. On Intel, this gives:
  30.  
  31. kings-cross:~$ ./align
  32. bar = 05040302
  33. kings-cross:~$
  34.  
  35. On Alpha, this gives:
  36.  
  37. paddington:~$ ./align 
  38. align(1964): unaligned trap at 0000000120000a74: 000000011ffff711 28 2
  39. bar = 05040302
  40. paddington:~$
  41.  
  42. But on an old ARM, you will get `bar = 0x04030201'.  The reason is that
  43. the dereference of `bar' compiles to an LDR instruction.  In general, the
  44. compiler can't know the alignment at compile-time, so there's not a lot
  45. else it *can* do.  Old ARM machines silently discard the low two address
  46. bits when you ask them to do a word access.  This differs, as I said
  47. before, from the Intel (where you get the correct access performed, albeit
  48. more slowly) and the Alpha/SPARC/etc (where you get a fault, and your OS
  49. has to patch up in software).
  50.  
  51. This sort of thing doesn't crop up *that* often, but it does happen, and
  52. code will go wrong when it does.  There is *very* little inline assembler
  53. in most things, and I doubt much porting work will be needed in general.
  54. A lot of autoconf scripts will probably need to be taught about Linux/ARM,
  55. but other than that...
  56.  
  57. > Basic sounds like quite a good idea. Shame it's copyright, really -
  58. > a basic interpretter running under general unix has some sort of appeal
  59. > to it :-)
  60.  
  61. Yes.  OTOH, although it's copyright, if it's in ROM it can be used fairly
  62. freely.  Someone sufficiently sick could probably write a snippet of code
  63. to be run as root that rummages around the RISC OS ROMs and pulls out the
  64. BASIC module. 
  65.  
  66. P.
  67.  
  68.